window.onload = function(){
    //配置
    var config = {
        vx: 4,//点x轴速度,正为右，负为左
        vy:  4,//点y轴速度
        height: 2,//点高宽，其实为正方形，所以不宜太大
        width: 2,
        count: 200,//点个数
        color: "200,193,193",//点颜色
        stroke: "0,0,0",//线条颜色
        dist: 0,//点吸附距离
        e_dist: 0,//鼠标吸附加速距离
        max_conn: 10//点到点最大连接数
    }
    //调用
    CanvasParticle(config);
}



let floors=$a('.floor')
$a('.body-right li').forEach(function(v,i){
    v.addEventListener('click',function(){
        let current=document.documentElement.scrollTop
        let target=floors[i].offsetTop
        let timer =null
        timer=setInterval(function(){
            if(target>current){
                current+=10
                document.documentElement.scrollTop=current
                
            }else{
                current-=10
                document.documentElement.scrollTop=current
                

            }
            if(Math.abs(target-current<=10)){
                clearInterval(timer)
                timer=null
                document.documentElement.scrollTop=target
                
            }

        },10)
        $a('.body-right li').forEach(function(a){
            a.classList.remove('right-li')
        })
        v.classList.add('right-li')
    })
   

})

